/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hvkdbmc.entities;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author admin
 */
public class HVKTableInfo {
    public String name;
    public Map<String,HVKColumnInfo> colums;

    public HVKTableInfo() {
        this.name = null;
        this.colums = new HashMap<String, HVKColumnInfo> ();
    }

    public HVKTableInfo(String name, Map<String,HVKColumnInfo> colums) {
        this.name = name;
        this.colums = colums;
    }

    public HVKTableInfo(String name) {
        this.name = name;
         this.colums = new HashMap<String, HVKColumnInfo> ();
    }
    
    public HVKColumnInfo getHVKColumnByName(String pColumnName)
    {
        if(this.colums!=null || this.colums.size()>0)
        {
            return colums.get(pColumnName);
        }
        else
            return null;
    }
     
    public String getTableClassName()   // TBL_ACCOUNT_ALL  ==> TblAccountAll
    {
       String[] nameParts = name.split("_");
        String result = "";
        for (String p : nameParts) {
            String pP = p.replace("_", "");
            pP = pP.toLowerCase();
            if (pP.length() >= 1) {
                pP = pP.substring(0, 1).toUpperCase() + pP.substring(1);
            }
            result += pP;
        }
       return result;
    }
    
        public String getTableClassNameLowerbegin()   // TBL_ACCOUNT_ALL  ==> TblAccountAll
    {
       String[] nameParts = name.split("_");
        String result = "";
        for (String p : nameParts) {
            String pP = p.replace("_", "");
            pP = pP.toLowerCase();
            if (pP.length() >= 1) {
                pP = pP.substring(0, 1).toUpperCase() + pP.substring(1);
            }
            result += pP;
        }
        result = result.substring(0,1).toLowerCase().concat(result.substring(1));
       return result;
    }
            
}
